using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._StandardFeatureAnalysisTools._AnalyzePatterns
{
    /// <summary>
    /// <para>Calculate Density</para>
    /// <para>Creates a density map from point or line features by spreading known quantities of some phenomenon (represented as attributes of the points or lines) across the map. The result is a layer of areas classified from least dense to most dense.</para>
    /// <para>通过在地图上散布某些现象的已知数量（表示为点或线的属性），从点或线要素创建密度地图。结果是将区域图层从密度从最低到最高。</para>
    /// </summary>    
    [DisplayName("Calculate Density")]
    public class CalculateDensity : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public CalculateDensity()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_inputLayer">
        /// <para>Input Features</para>
        /// <para>The point or line features from which to calculate density.</para>
        /// <para>用于计算密度的点或线要素。</para>
        /// </param>
        /// <param name="_outputName">
        /// <para>Output Name</para>
        /// <para>The name of the output layer to create on your portal.</para>
        /// <para>要在门户上创建的输出图层的名称。</para>
        /// </param>
        public CalculateDensity(object _inputLayer, object _outputName)
        {
            this._inputLayer = _inputLayer;
            this._outputName = _outputName;
        }
        public override string ToolboxName => "Standard Feature Analysis Tools";

        public override string ToolName => "Calculate Density";

        public override string CallName => "sfa.CalculateDensity";

        public override List<string> AcceptEnvironments => ["extent"];

        public override object[] ParameterInfo => [_inputLayer, _outputName, _field, _cellSize, _cellSizeUnits.GetGPValue(), _radius, _radiusUnits.GetGPValue(), _boundingPolygonLayer, _areaUnits.GetGPValue(), _classificationType.GetGPValue(), _numClasses, _outputLayer];

        /// <summary>
        /// <para>Input Features</para>
        /// <para>The point or line features from which to calculate density.</para>
        /// <para>用于计算密度的点或线要素。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Features")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _inputLayer { get; set; }


        /// <summary>
        /// <para>Output Name</para>
        /// <para>The name of the output layer to create on your portal.</para>
        /// <para>要在门户上创建的输出图层的名称。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Name")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _outputName { get; set; }


        /// <summary>
        /// <para>Count Field</para>
        /// <para><xdoc>
        ///   <para>A field specifying the number of incidents at each location. For example, if you have points that represent cities, you can use a field representing the population of the city as the count field, and the resulting population density layer will calculate larger population densities near cities with larger populations.</para>
        ///   <para>If not specified, each location will be assumed to represent a single count.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定每个位置的事件数的字段。例如，如果具有表示城市的点，则可以使用表示城市人口的字段作为计数字段，生成的人口密度图层将计算人口较多的城市附近的较大人口密度。</para>
        ///   <para>如果未指定，则假定每个位置表示单个计数。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Count Field")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _field { get; set; } = null;


        /// <summary>
        /// <para>Cell Size</para>
        /// <para>This value is used to create a mesh of points where density values are calculated. The default is approximately 1/1000th of the smaller of the width and height of the analysis extent as defined in the context parameter. The smaller the value, the smoother the polygon boundaries will be. Conversely, with larger values, the polygon boundaries will be more coarse and jagged.</para>
        /// <para>此值用于创建计算密度值的点网格。默认值约为上下文参数中定义的分析范围宽度和高度的较小值的 1/1000。该值越小，多边形边界越平滑。相反，当值越大时，多边形边界将更加粗糙和锯齿状。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Cell Size")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public double? _cellSize { get; set; } = null;


        /// <summary>
        /// <para>Cell Size Units</para>
        /// <para><xdoc>
        ///   <para>The units of the cell size value. You must provide a value if cell size has been set.</para>
        ///   <bulletList>
        ///     <bullet_item>Miles—Miles</bullet_item><para/>
        ///     <bullet_item>Feet—Feet</bullet_item><para/>
        ///     <bullet_item>Kilometers—Kilometers</bullet_item><para/>
        ///     <bullet_item>Meters—Meters</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>单元格大小值的单位。如果已设置单元格大小，则必须提供一个值。</para>
        ///   <bulletList>
        ///     <bullet_item>英里 - 英里</bullet_item><para/>
        ///     <bullet_item>英尺 - 英尺</bullet_item><para/>
        ///     <bullet_item>公里 - 公里</bullet_item><para/>
        ///     <bullet_item>米 - 米</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Cell Size Units")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _cellSizeUnits_value? _cellSizeUnits { get; set; } = null;

        public enum _cellSizeUnits_value
        {
            /// <summary>
            /// <para>Miles</para>
            /// <para>Miles—Miles</para>
            /// <para>英里 - 英里</para>
            /// </summary>
            [Description("Miles")]
            [GPEnumValue("MILES")]
            _MILES,

            /// <summary>
            /// <para>Feet</para>
            /// <para>Feet—Feet</para>
            /// <para>英尺 - 英尺</para>
            /// </summary>
            [Description("Feet")]
            [GPEnumValue("FEET")]
            _FEET,

            /// <summary>
            /// <para>Kilometers</para>
            /// <para>Kilometers—Kilometers</para>
            /// <para>公里 - 公里</para>
            /// </summary>
            [Description("Kilometers")]
            [GPEnumValue("KILOMETERS")]
            _KILOMETERS,

            /// <summary>
            /// <para>Meters</para>
            /// <para>Meters—Meters</para>
            /// <para>米 - 米</para>
            /// </summary>
            [Description("Meters")]
            [GPEnumValue("METERS")]
            _METERS,

        }

        /// <summary>
        /// <para>Radius</para>
        /// <para><xdoc>
        ///   <para>A distance specifying how far to search to find point or line features when calculating density values. For example, if you provide a search distance of 1,800 meters, the density of any location in the output layer is calculated based on features that are within 1,800 meters of the location. Any location that does not have any incidents within 1,800 meters will receive a density value of zero.</para>
        ///   <para>If no distance is provided, a default will be calculated based on the locations of the input features and the values in the count field (if a count field is provided).</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定在计算密度值时搜索以查找点或线要素的距离。例如，如果提供 1,800 米的搜索距离，则输出图层中任何位置的密度将基于距离该位置 1,800 米以内的要素进行计算。任何在 1,800 米内未发生任何事件的位置都将收到零的密度值。</para>
        ///   <para>如果未提供距离，则将根据输入要素的位置和计数字段中的值（如果提供了计数字段）计算默认值。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Radius")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public double? _radius { get; set; } = null;


        /// <summary>
        /// <para>Radius Units</para>
        /// <para><xdoc>
        ///   <para>The units of the radius value. You must provide a value if a radius has been set.</para>
        ///   <bulletList>
        ///     <bullet_item>Miles—Miles</bullet_item><para/>
        ///     <bullet_item>Feet—Feet</bullet_item><para/>
        ///     <bullet_item>Kilometers—Kilometers</bullet_item><para/>
        ///     <bullet_item>Meters—Meters</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>半径值的单位。如果已设置半径，则必须提供一个值。</para>
        ///   <bulletList>
        ///     <bullet_item>英里 - 英里</bullet_item><para/>
        ///     <bullet_item>英尺 - 英尺</bullet_item><para/>
        ///     <bullet_item>公里 - 公里</bullet_item><para/>
        ///     <bullet_item>米 - 米</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Radius Units")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _radiusUnits_value? _radiusUnits { get; set; } = null;

        public enum _radiusUnits_value
        {
            /// <summary>
            /// <para>Miles</para>
            /// <para>Miles—Miles</para>
            /// <para>英里 - 英里</para>
            /// </summary>
            [Description("Miles")]
            [GPEnumValue("MILES")]
            _MILES,

            /// <summary>
            /// <para>Feet</para>
            /// <para>Feet—Feet</para>
            /// <para>英尺 - 英尺</para>
            /// </summary>
            [Description("Feet")]
            [GPEnumValue("FEET")]
            _FEET,

            /// <summary>
            /// <para>Kilometers</para>
            /// <para>Kilometers—Kilometers</para>
            /// <para>公里 - 公里</para>
            /// </summary>
            [Description("Kilometers")]
            [GPEnumValue("KILOMETERS")]
            _KILOMETERS,

            /// <summary>
            /// <para>Meters</para>
            /// <para>Meters—Meters</para>
            /// <para>米 - 米</para>
            /// </summary>
            [Description("Meters")]
            [GPEnumValue("METERS")]
            _METERS,

        }

        /// <summary>
        /// <para>Bounding Polygons</para>
        /// <para>A layer specifying the polygons where you want densities to be calculated. For example, if you are interpolating densities of fish within a lake, you can use the boundary of the lake in this parameter and the output will only draw within the boundary of the lake.</para>
        /// <para>指定要计算密度的面的图层。例如，如果要插值湖内鱼类的密度，则可以在此参数中使用湖的边界，并且输出将仅在湖的边界内绘制。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Bounding Polygons")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _boundingPolygonLayer { get; set; } = null;


        /// <summary>
        /// <para>Area Units</para>
        /// <para><xdoc>
        ///   <para>The units of the calculated density values.</para>
        ///   <bulletList>
        ///     <bullet_item>Square miles—Square miles</bullet_item><para/>
        ///     <bullet_item>Square kilometers—Square kilometers</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>计算密度值的单位。</para>
        ///   <bulletList>
        ///     <bullet_item>平方英里 - 平方英里</bullet_item><para/>
        ///     <bullet_item>平方公里 - 平方公里</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Area Units")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _areaUnits_value _areaUnits { get; set; } = _areaUnits_value._SQUAREMILES;

        public enum _areaUnits_value
        {
            /// <summary>
            /// <para>Square miles</para>
            /// <para>Square miles—Square miles</para>
            /// <para>平方英里 - 平方英里</para>
            /// </summary>
            [Description("Square miles")]
            [GPEnumValue("SQUAREMILES")]
            _SQUAREMILES,

            /// <summary>
            /// <para>Square kilometers</para>
            /// <para>Square kilometers—Square kilometers</para>
            /// <para>平方公里 - 平方公里</para>
            /// </summary>
            [Description("Square kilometers")]
            [GPEnumValue("SQUAREKILOMETERS")]
            _SQUAREKILOMETERS,

        }

        /// <summary>
        /// <para>Classification Type</para>
        /// <para><xdoc>
        ///   <para>Determines how density values will be classified into polygons.</para>
        ///   <bulletList>
        ///     <bullet_item>Equal interval— Polygons are created such that the range of density values is equal for each area.</bullet_item><para/>
        ///     <bullet_item>Geometric interval— Polygons are based on class intervals that have a geometric series. This method ensures that each class range has approximately the same number of values within each class and that the change between intervals is consistent.</bullet_item><para/>
        ///     <bullet_item>Natural breaks— Class intervals for polygons are based on natural groupings of the data. Class break values are identified that best group similar values and that maximize the differences between classes.</bullet_item><para/>
        ///     <bullet_item>Equal area— Polygons are created such that the size of each area is equal. For example, if the result has more high-density values than low-density values, more polygons will be created for high densities.</bullet_item><para/>
        ///     <bullet_item>Standard deviation— Polygons are created based upon the standard deviation of the predicted density values.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>确定如何将密度值分类为多边形。</para>
        ///   <bulletList>
        ///     <bullet_item>相等间隔 - 创建多边形，使每个区域的密度值范围相等。</bullet_item><para/>
        ///     <bullet_item>几何区间 - 多边形基于具有几何序列的类区间。此方法可确保每个类范围在每个类中具有大致相同的值数，并且间隔之间的更改是一致的。</bullet_item><para/>
        ///     <bullet_item>自然中断 - 面的类间隔基于数据的自然分组。确定类间隔值，以最好地对相似值进行分组，并最大化类之间的差异。</bullet_item><para/>
        ///     <bullet_item>相等面积 - 创建多边形时，每个区域的大小相等。例如，如果结果的高密度值多于低密度值，则将为高密度创建更多多边形。</bullet_item><para/>
        ///     <bullet_item>标准差 - 多边形是根据预测密度值的标准差创建的。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Classification Type")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _classificationType_value _classificationType { get; set; } = _classificationType_value._EQUALINTERVAL;

        public enum _classificationType_value
        {
            /// <summary>
            /// <para>Equal interval</para>
            /// <para>Equal interval— Polygons are created such that the range of density values is equal for each area.</para>
            /// <para>相等间隔 - 创建多边形，使每个区域的密度值范围相等。</para>
            /// </summary>
            [Description("Equal interval")]
            [GPEnumValue("EQUALINTERVAL")]
            _EQUALINTERVAL,

            /// <summary>
            /// <para>Geometric interval</para>
            /// <para>Geometric interval— Polygons are based on class intervals that have a geometric series. This method ensures that each class range has approximately the same number of values within each class and that the change between intervals is consistent.</para>
            /// <para>几何区间 - 多边形基于具有几何序列的类区间。此方法可确保每个类范围在每个类中具有大致相同的值数，并且间隔之间的更改是一致的。</para>
            /// </summary>
            [Description("Geometric interval")]
            [GPEnumValue("GEOMETRICINTERVAL")]
            _GEOMETRICINTERVAL,

            /// <summary>
            /// <para>Natural breaks</para>
            /// <para>Natural breaks— Class intervals for polygons are based on natural groupings of the data. Class break values are identified that best group similar values and that maximize the differences between classes.</para>
            /// <para>自然中断 - 面的类间隔基于数据的自然分组。确定类间隔值，以最好地对相似值进行分组，并最大化类之间的差异。</para>
            /// </summary>
            [Description("Natural breaks")]
            [GPEnumValue("NATURALBREAKS")]
            _NATURALBREAKS,

            /// <summary>
            /// <para>Equal area</para>
            /// <para>Equal area— Polygons are created such that the size of each area is equal. For example, if the result has more high-density values than low-density values, more polygons will be created for high densities.</para>
            /// <para>相等面积 - 创建多边形时，每个区域的大小相等。例如，如果结果的高密度值多于低密度值，则将为高密度创建更多多边形。</para>
            /// </summary>
            [Description("Equal area")]
            [GPEnumValue("EQUALAREA")]
            _EQUALAREA,

            /// <summary>
            /// <para>Standard deviation</para>
            /// <para>Standard deviation— Polygons are created based upon the standard deviation of the predicted density values.</para>
            /// <para>标准差 - 多边形是根据预测密度值的标准差创建的。</para>
            /// </summary>
            [Description("Standard deviation")]
            [GPEnumValue("STANDARDDEVIATION")]
            _STANDARDDEVIATION,

        }

        /// <summary>
        /// <para>Number of Classes</para>
        /// <para><xdoc>
        ///   <para>This value is used to divide the range of predicted values into distinct classes. The range of values in each class is determined by the classification type. Each class defines the boundaries of the result polygons.</para>
        ///   <para>The default is 10 and the maximum is 32.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>此值用于将预测值的范围划分为不同的类。每个类中的值范围由分类类型确定。每个类定义结果多边形的边界。</para>
        ///   <para>默认值为 10，最大值为 32。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Number of Classes")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long _numClasses { get; set; } = 10;


        /// <summary>
        /// <para>Output Layer</para>
        /// <para></para>
        /// <para></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Layer")]
        [Description("")]
        [Option(OptionTypeEnum.derived)]
        public object _outputLayer { get; set; }


        public CalculateDensity SetEnv(object extent = null)
        {
            base.SetEnv(extent: extent);
            return this;
        }

    }

}